const joi = require('joi')
const rule = {
	account: joi.string().min(1).max(16).required(),
	password: joi.string().pattern(/^[\S]{6,12}$/).required()
}
const email = joi.string().email()
const resetPwd = {
	oldPwd: rule.password,
	newPwd: joi.not(joi.ref('oldPwd')).concat(rule.password)
}
const avatar = {
	handimg: joi.string().dataUri().required()
}
const update = {
	account: joi.string().min(1).max(16),
	password: joi.string().pattern(/^[\S]{6,12}$/),
	userid: joi.string(),
	email
}
module.exports = {
	user: {
		body: rule
	},
	update: {
		body: update
	},
	resetPwd:{
		body: resetPwd
	},
	avatar: {
		body: avatar
	}
}
